﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using DAL.Core.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace xBot.Tests
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void GetJsonDataFromReddit()
        {
            using (var www = new WebClient())
            {
                var model = www.DownloadString("http://www.reddit.com/r/funny.json?limit=100");
                var t1 = JsonConvert.DeserializeObject<JObject>(model);
                var t2 = new List<string>();
                var t3 = t1["data"]["children"];


                foreach (var item in t1["data"]["children"])
                {
                 Debug.WriteLine(item);   
                }

                Assert.IsNotNull(model);
                Assert.IsNotNull(t1);
            }
        }
    }
}
